<template>
    <div>
      
        <div :style="{padding: '24px', minHeight: '480px', background: '#fff'}">
            <el-form ref="queryParams" inline label-position="right" label-width="80px" v-model="queryParams">
                <el-form-item label="库位码">
                    <el-input  size="small" v-model="queryParams.localCode" placeholder="库位码" style="width: 160px" />
                </el-form-item>
               
                <el-form-item label="仓库名称">
                    <el-input  size="small" v-model="queryParams.warehouseName" placeholder="仓库名称" style="width: 160px" />
                </el-form-item>
                <el-form-item>
                    <el-button  size="small" v-on:click="search()" type="primary">{{$t('搜索')}}</el-button>
                    <el-button  size="small" v-on:click="reset()">{{$t('重置')}}</el-button>
                </el-form-item>
           </el-form>
            <el-alert type="warning" >有需要存放的可以联系对应仓库的管理员</el-alert>
            <Table :loading="loading" :columns="columns" :data="shelvesLocations" border>
            </Table>
            <div style="margin: 10px;overflow: hidden">
                <div style="float: right;">
                    <Page :page-size="page.pageSize" show-total :total="page.total" :current="page.current" @on-change="changePage"></Page>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    name: 'ShelvesLocation',
    data() {
        return {
            loading: false,
            queryParams: {

            },
            shelvesLocation: {

            },
            page: {
                total: 0,
                current: 1,
                pageSize: 10
            },
            shelvesLocations: [

            ],
            rules: {},
            columns: [ {
                    title: '所在仓库',
                    key: 'warehouseName',
                    width: 180,
                    align: 'center'
                },{
                    title: '库位码',
                    key: 'localCode',
                    width: 180,
                    align: 'center'
                }

            ]
        };
    },
    mounted: function() {
        
        this.getList();

    },
    methods: {

        search: function() {
            this.page.current = 1;
            this.page.total = 0;
            this.getList();
        },
        reset: function() {
            this.queryParams = {};
        },
        changePage(current) {
            this.page.current = current;
            this.getList();
        },
        getList: function() {
            var me = this;
            var params = me.queryParams;
            params.current = me.page.current;
            params.pageSize = me.page.pageSize;
            me.loading = true;
            me.$http.post("/storageproduct/shelves/getList.do", params).then(response => {
                var body = response;
                if (body.status == 0) {
                    me.page.total = body.obj.totalCount;
                    me.shelvesLocations = body.obj.list;

                }
                me.loading = false;
            }, response => {
                me.loading = false;
            });
        }

    }
}
</script>
<style scoped>
</style>